<!DOCTYPE HTML>
<% var nvgurl = ['/', '/problemset', '/status', '/ranklist', '/contest/1', '/contest/2', '/topic/100', '/topic'], nvgname = ['Home', 'Problemset', 'Status', 'Ranklist', 'DIY Contest', 'VIP Contest', 'FAQ', 'Forum']; %>
<% var stc = partial('post_list').split('\n'); %>
<html>
  <head>
    <meta name="description" content="ACdream. Programming competitions and contests, programming community">
    <meta name="keywords" content="ACdream OnlineJudge OJ ACM ICPC Contest online judge programming">
    <title id="title"><%= title %></title>
    <link href="/stylesheets/bootstrap.css" rel="stylesheet" type="text/css"/>
    <link href="/stylesheets/style.css" rel="stylesheet" type="text/css"/>
  <% if (key == 8 || key == 11 || key == 18) { %>
    <link rel="stylesheet" type="text/css" href="/highlighter/styles/shCoreEclipse.css"/>
  <% } else if (key == 1002) { %>
    <link rel="stylesheet" href="/zd/css/zebra_datepicker.css" type="text/css"/>
  <% } %>
  <!--[if lt IE 9]>
    <link href="/stylesheets/ie.css" rel="stylesheet"/>
  <![endif]-->
  </head>
  <body id="wrapper">
    <div class="w">
      <marquee style="float:left;width:50%;" id="marquee" onmouseout="this.start()" onmouseover="this.stop()" scrollamount="2" scrolldelay="1" behavior="alternate">
        <span class="user user-green"><%= stc[Math.round(Math.random()*(stc.length - 1))] %>～</span>
      </marquee>
      <ul class="navigation">
    <% if (!user) { %>
        <li><a href="javascript:;" id="reg">Register</a></li>
        <li><span class="user-gray">|</span></li>
        <li><a href="javascript:;" id="login">Enter</a></li>
    <% } else { %>
        <li><a href="javascript:;" id="logout">Logout</a></li>
        <li><span class="user-gray">|</span></li>
      <% if (user.name == 'admin') { %>
        <li><span class="user-gray">|</span></li>
      <% } %>
      <% if (user.addprob == 1) { %>
        <% if (key == 1000) { %>
        <li class="active">Add Problem</li>
        <% } else { %>
        <li><a href="/addproblem">Add Problem</a></li>
        <% } %>
        <li><span class="user-gray">|</span></li>
      <% } %>
        <li><a href='/user/<%= user.name %>'><%= user.name %></a></li>
    <% } %>
      </ul>
    </div>
    <div class="w" id="preload_logo">
    <% if (user) { %>
      <% var img = '/img/avatar/%3Ddefault%3D/3.jpeg'; %>
      <% if (user.imgType) { img = '/img/avatar/'+user.name+'/3.'+user.imgType; } %>
        <a class="fr" href="/avatar" style="margin-top:5px;">
          <img class="img_m topic_img" title="change picture" alt="change picture" src="<%= img %>" />
        </a>
    <% } else { %>
        <a class="fr" target="_blank" href="https://github.com/KIDx/ACdream" style="margin-top:5px;">
          <img class="img_m topic_img" title="Fork me on Github." alt="Fork me on Github." src="/img/git.png" />
        </a>
    <% } %>
      <a class="logo" href="/" title="ACdream Online Judge">
        <img src="/img/logo.png" alt="ACdream Online Judge" />
      </a>
    </div>
    <div class="w">
      <div class="fr">
        <input type="text" style="padding:2px;margin:0;font-size:12px;" class="input-small" placeholder=" Problem ID" title="Problem ID">
        <a id="Go" class="uibtn" href="javascript:;">Go</a>
      </div>
      <ul class="navigation menu">
        <% for (var i = 0; i < nvgurl.length; i++) { %>
        <li><a href="<%= nvgurl[i] %>"><%= nvgname[i] %></a></li>
        <% } %>
      </ul>
    </div>
    <div class="w"  id="xbody">
      <%- body %>
    </div>
    <div class="w" id="footer">
      <div><a href="/">ACdream v1.1.5</a> 2013-2014 KIDx(网站), TTLast(评测机)</div>
      <div>Any bug please contact 972169909@qq.com</div>
      <div>Server time: <span <% if(key == 6) { %>type="<%= type %>"<% } %> <% if (user) { %>user="<%= user.name %>"<% } %> time="<%= time %>" id="timer"></span></div>
      <div><a href="http://www.miitbeian.gov.cn/ ">浙ICP备14013846号</a></div>
    </div>
    <div id="go_top" title="Go to top"></div>
  <!--****************Dialogs****************-->
    <% if (!user) { %>
      <%- partial('D_login') %>
      <%- partial('D_register') %>
    <% } %>
    <% if (key == 0) { %>
      <% if (user) { %>
      <%- partial('D_settings', {u:u}) %>
      <% } %>
    <% } else if (key == 4) { %>
      <%- partial('D_ce') %>
    <% } else if (key == 6) { %>
      <% if (type != 2) { %>
        <%- partial('D_logincontest') %>
      <% } %>
    <% } else if (key == 9) { %>
      <%- partial('D_ce') + partial('D_broadcast') %>
      <% if (user) { %>
      <%- partial('D_submit', {langs: langs}) %>
      <% } %>
    <% } %>
  <!--****************Dialogs****************-->
  <!-- js Placed at the end of the document so the pages load faster -->
    <script src="/javascripts/jquery_uieffect_jqdnr.js"></script>
    <script src="/javascripts/jquery.cookie.js"></script>
    <script src="/javascripts/Global.js"></script>
  <% var highlight = '<script src="/highlighter/scripts/shCore_brushCpp_brushJava.js"></script><script type="text/javascript">SyntaxHighlighter.defaults[\'toolbar\'] = false;SyntaxHighlighter.all();</script>'; %>
  <% if (key == 0) { %>
    <script src="/Highcharts-4.0.1/highcharts.js"></script>
    <script src="/javascripts/user.js"></script>
  <% } else if (key == 1) { %>
    <script src="/Highcharts-4.0.1/highcharts.js"></script>
    <script src="/Highcharts-4.0.1/main.js"></script>
    <script src="/javascripts/statistic.js"></script>
  <% } else if (key == 3) { %>
    <script src="/javascripts/problemset.js"></script>
  <% } else if (key == 5) { %>
    <script src="/javascripts/ranklist.js"></script>
  <% } else if (key == 6) { %>
    <script src="/javascripts/contest.js"></script>
  <% } else if (key == 8) { %>
    <%- highlight %>
    <script src="/javascripts/fileUpload.js"></script>
    <script src="/javascripts/problem.js"></script>
  <% } else if (key == 9) { %>
    <script src="/javascripts/jquery.hashchange.js"></script>
    <script src="/javascripts/updatestatus.js"></script>
    <% if (user && user.name == 'admin') { %>
    <script src="/javascripts/singleRejudge.js"></script>
    <% } %>
    <script src="/socket.io/socket.io.js"></script>
    <script src="/javascripts/onecontest.js"></script>
  <% } else if (key == 4) { %>
    <script src="/javascripts/updatestatus.js"></script>
    <% if (user && user.name == 'admin') { %>
    <script src="/javascripts/singleRejudge.js"></script>
    <% } %>
    <script src="/javascripts/status.js"></script>
  <% } else if (key == 10) { %>
    <script src="/javascripts/submit.js"></script>
  <% } else if (key == 11){ %>
    <%- highlight %>
  <% } else if (key == 12) { %>
    <script src="/javascripts/fileUpload.js"></script>
    <script src="/javascripts/avatar.js"></script>
  <% } else if (key == 17) { %>
    <script src="/javascripts/topic.js"></script>
  <% } else if (key == 18) { %>
    <%- highlight %>
    <% if (user) { %>
    <script src="/ckeditor/ckeditor.js"></script>
    <% } %>
    <script src="/javascripts/onetopic.js"></script>
  <% } else if (key == 1002) { %>
    <script src="/javascripts/addcontest.js"></script>
    <script src="/zd/javascript/zebra_datepicker.js"></script>
  <% } else if (key == 1000 || key == 1001) { %>
    <script src="/javascripts/fileUpload.js"></script>
    <script src="/ckeditor/ckeditor.js"></script>
    <script src="/javascripts/addproblem.js"></script>
  <% } else if (key == 1004) { %>
    <script src="/ckeditor/ckeditor.js"></script>
    <script src="/javascripts/addtopic.js"></script>
  <% } %>
  </body>
</html>